package service

import (
	"singo/model"
	"singo/serializer"
)

// OrganizationShowService 组织详情的服务
type OrganizationShowService struct {
}

// OrganizationShow 组织
func (service *OrganizationShowService) OrganizationShow(uid string) serializer.Response {
	var organization model.Organization
	err := model.DB.First(&organization, "uid = ?", uid).Error
	if err != nil {
		return serializer.Response{
			Status: 404,
			Msg:    "组织不存在",
			Error:  err.Error(),
		}
	}

	return serializer.Response{
		Data: serializer.BuildOrganization(organization),
	}
}
